#include<iostream> 
using namespace std;

#define e str[i]
int main()
{
	string str;
	getline(cin,str);
	size_t ret = 0, flag = 0;
    int flag1= 0;
    int flag2 = 0;
    for(int i =0;str[i] != '\0';i++)
    {
        if(flag2 == 1 && (e >= '0' && e <= '9'))
            break;
        if(e == '-')
        {
            if(flag == 0)
            {
                flag = 1;
                flag2 = 1;
            }
            else
                break;
        }
        if(e == '+')
        {
            if(flag == 1)
                break;
            else
            {
                 flag = 2;
                 flag2 =1;
            }
        }
        if(e!= '+' &&e != ' ' && e != '-' &&!(e >= '0' && e <= '9'))
            break;
        if(e != ' ' && (e >= '0' && e <= '9'))
        {
            flag2 = 1;
            if(ret*10 + (int)(e - '0') > INT_MAX)
            {
            	flag1 = 1;
                if(flag == 1)
                {
                    ret = INT_MIN;
                    //cout<<INT_MIN<<endl;
                }
                else
                    ret = INT_MAX;
            	    //cout<<INT_MAX-1<<endl;
                break;
            }                       
           	
            ret = ret*10 + (int)(e - '0');           
        }
   }
    if(flag1 == 0)
    {
        if(flag == 1)
        {
            ret = -ret;
        }
        //cout<<ret<<endl;
    }
 	return 0; 
}
